/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.main;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.mes.mapper.main.ProduceTraceabilityMapper;
public class ProduceTraceability extends BaseAction
{
    @Autowired(required=false)
	private ProduceTraceabilityMapper mapper;
    /**
    生产追溯
    */
    
    public Map produceTraceability() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> p_flow=mapper.p_flow(params,pagination);
        p_flow.setPagedListInfo(pagination);
        result.put("p_flow", p_flow);
        
        return result;
    }
    /**
    即时监控
    */
    
    public Map produceMonitoring() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        String userColumns=getSql("userColumns");
        
        
        Object workName =mapper.workName(params);
        result.put("workName", workName);
        
        
        Object CMFLOWWORKID =mapper.CMFLOWWORKID(params);
        result.put("CMFLOWWORKID", CMFLOWWORKID);
        
        
        SQLList<SQLMap> steps=mapper.steps(params);
        result.put("steps", steps);
        
        
        SQLList<SQLMap> skips=mapper.skips(params);
        result.put("skips", skips);
        
        return result;
    }
    /**
    节点页面
    */
    
    public Map stepPage() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_step=mapper.s_step(params);
        SQLMap s_step_emt=s_step.getExistfirst();
        result.put("s_step", s_step_emt);
        
        return result;
    }
    /**
    采购流程
    */
    
    public Map purchaseFlow() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> steps=mapper.steps(params);
        result.put("steps", steps);
        
        
        SQLList<SQLMap> skips=mapper.skips(params);
        result.put("skips", skips);
        
        return result;
    }
    /**
    选择工作流
    */
    
    public Map produceFlowSelect() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_category=mapper.s_category(params);
        result.put("s_category", s_category);
        
        return result;
    }
    /**
    生产作业列表
    */
    
    public Map produceOperator() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        SQLList<SQLMap> steps=mapper.steps(params);
        result.put("steps", steps);
        
        
        SQLList<SQLMap> purchases=mapper.purchases(params);
        result.put("purchases", purchases);
        
        
        tb = createTreeBean("s_flow_treecols");
        SQLList<SQLMap> s_flow=mapper.s_flow(params);
        s_flow = s_flow.buildTree(tb,tb.getPid());
        result.put("s_flow", s_flow);
        
        return result;
    }
    /**
    步骤状态修改
    */
    
    public Map stepStatusSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.stepStatusSubmit(params);
        
        return result;
    }
    /**
    增加工序流程修改
    */
    
    public Map produceFlowAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int plan_work_id = mapper.plan_work_id(params);
        result.put("plan_work_id", plan_work_id);
        
        
        
        
        int u_skipwork = mapper.u_skipwork(params);
        result.put("u_skipwork", u_skipwork);
        
        return result;
    }
}